import { http } from '@/utils/request'
import type { User, ApiResponse } from '@/types'

// 更新用户信息
export const updateUserProfile = (data: {
  realName?: string;
  email?: string;
  phone?: string;
  avatar?: string;
}): Promise<ApiResponse<User>> => {
  return http.put('/client/user/profile', data)
}

// 上传头像
export const uploadAvatar = (file: File): Promise<ApiResponse<{
  url: string;
}>> => {
  const formData = new FormData()
  formData.append('avatar', file)
  
  return http.post('/client/user/avatar', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
} 